﻿//***********************************************************************************//
// Autor:  			Adrian Di Puglia      						     				*//
//***********************************************************************************//
//  Cleaner page                                                                    *//
// _________________________________________________________________________________*//
var submitted = false;
var cleaned = false;

$(document).ready(function () {
    window.onbeforeunload = function (e) {
        if (!submitted && !cleaned) {
            var message = ">>>>>ADVERTENCIA<<<<<<<< \n\n Si ABANDONA la Página perderá las Respuestas Ingresadas en el Problemario.", e = e || window.event;
            if (e) {
                e.returnValue = message;
            }
            return message;
        }
    }

    $("form").submit(function () {
        submitted = true;
        cleaned = true;
    });

    document.getElementsByTagName("button")[0].onclick = function (e) {
        submitted = true;
        cleaned = true;
        //window.location.href = window.location.href
        window.location.assign(window.location.href);
    };

});